package collection;

import java.util.ArrayList;
import java.util.Collection;

public class CollectionDemo {
    public static void main(String[] args) {
        Collection c = new ArrayList();

        c.add("one");//集合存放元素各种类型
        c.add("two");
        c.add("three");
        c.add("four");
        c.add("five");
        System.out.println(c);
        int size = c.size();//大小 类似于数组的长
        System.out.println("size:" + size);
        //isEmpty检测是否为空集合返回类型是boolean
        boolean isEmpty = c.isEmpty();
        System.out.println("是否为空集:" + isEmpty);
        //clear为初始化集合，清空
        c.clear();
        System.out.println(c);
        System.out.println("size:" + c.size());
        System.out.println("是否为空集:" + c.isEmpty());
    }

}
